/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entitybean;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Admin
 */
@Entity
@Table(name = "media", catalog = "OnlineShopFourDVD", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "Media.findAll", query = "SELECT m FROM Media m"),
    @NamedQuery(name = "Media.findByMediaId", query = "SELECT m FROM Media m WHERE m.mediaId = :mediaId"),
    @NamedQuery(name = "Media.findByTitle", query = "SELECT m FROM Media m WHERE m.title LIKE :title"),
    @NamedQuery(name = "Media.findByPrice", query = "SELECT m FROM Media m WHERE m.price = :price"),
    @NamedQuery(name = "Media.findByRepresentImg", query = "SELECT m FROM Media m WHERE m.representImg = :representImg"),
    @NamedQuery(name = "Media.findByDate", query = "SELECT m FROM Media m WHERE m.date = :date"),
    @NamedQuery(name = "Media.findByQuantity", query = "SELECT m FROM Media m WHERE m.quantity = :quantity"),
    @NamedQuery(name = "Media.findByActor", query = "SELECT m FROM Media m WHERE m.actor = :actor"),
    @NamedQuery(name = "Media.findByOtherInfo", query = "SELECT m FROM Media m WHERE m.otherInfo = :otherInfo"),
    @NamedQuery(name = "Media.findByFreeMovie", query = "SELECT m FROM Media m WHERE m.freeMovie = :freeMovie"),
    @NamedQuery(name = "Media.findByCountLike", query = "SELECT m FROM Media m WHERE m.countLike = :countLike")})
public class Media implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "media_id", nullable = false)
    private Integer mediaId;
    @Column(name = "title", length = 50)
    private String title;
    @Column(name = "price", precision = 53)
    private Double price;
    @Column(name = "represent_img", length = 50)
    private String representImg;
    @Column(name = "date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date date;
    @Column(name = "quantity")
    private Integer quantity;
    @Column(name = "actor", length = 50)
    private String actor;
    @Column(name = "other_info", length = 100)
    private String otherInfo;
    @Column(name = "free_movie")
    private Character freeMovie;
    @Column(name = "count_like")
    private Integer countLike;
    @ManyToMany(mappedBy = "mediaCollection")
    private Collection<Category> categoryCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "media")
    private Collection<MediaComment> mediaCommentCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "media")
    private Collection<MediaDetail> mediaDetailCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "media")
    private Collection<MediaLike> mediaLikeCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "media")
    private Collection<Promotions> promotionsCollection;
    @JoinColumn(name = "suppliers_id", referencedColumnName = "supplier_id")
    @ManyToOne
    private Suppliers suppliers;
    @JoinColumn(name = "producer_id", referencedColumnName = "producer_id")
    @ManyToOne
    private Producers producers;
    @JoinColumn(name = "country_id", referencedColumnName = "country_id")
    @ManyToOne
    private Country country;
    @JoinColumn(name = "artist_id", referencedColumnName = "artist_id")
    @ManyToOne
    private Artist artist;

    public Media() {
    }

    public Media(Integer mediaId) {
        this.mediaId = mediaId;
    }

    public Integer getMediaId() {
        return mediaId;
    }

    public void setMediaId(Integer mediaId) {
        this.mediaId = mediaId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public String getRepresentImg() {
        return representImg;
    }

    public void setRepresentImg(String representImg) {
        this.representImg = representImg;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public Integer getQuantity() {
        return quantity;
    }

    public void setQuantity(Integer quantity) {
        this.quantity = quantity;
    }

    public String getActor() {
        return actor;
    }

    public void setActor(String actor) {
        this.actor = actor;
    }

    public String getOtherInfo() {
        return otherInfo;
    }

    public void setOtherInfo(String otherInfo) {
        this.otherInfo = otherInfo;
    }

    public Character getFreeMovie() {
        return freeMovie;
    }

    public void setFreeMovie(Character freeMovie) {
        this.freeMovie = freeMovie;
    }

    public Integer getCountLike() {
        return countLike;
    }

    public void setCountLike(Integer countLike) {
        this.countLike = countLike;
    }

    public Collection<Category> getCategoryCollection() {
        return categoryCollection;
    }

    public void setCategoryCollection(Collection<Category> categoryCollection) {
        this.categoryCollection = categoryCollection;
    }

    public Collection<MediaComment> getMediaCommentCollection() {
        return mediaCommentCollection;
    }

    public void setMediaCommentCollection(Collection<MediaComment> mediaCommentCollection) {
        this.mediaCommentCollection = mediaCommentCollection;
    }

    public Collection<MediaDetail> getMediaDetailCollection() {
        return mediaDetailCollection;
    }

    public void setMediaDetailCollection(Collection<MediaDetail> mediaDetailCollection) {
        this.mediaDetailCollection = mediaDetailCollection;
    }

    public Collection<MediaLike> getMediaLikeCollection() {
        return mediaLikeCollection;
    }

    public void setMediaLikeCollection(Collection<MediaLike> mediaLikeCollection) {
        this.mediaLikeCollection = mediaLikeCollection;
    }

    public Collection<Promotions> getPromotionsCollection() {
        return promotionsCollection;
    }

    public void setPromotionsCollection(Collection<Promotions> promotionsCollection) {
        this.promotionsCollection = promotionsCollection;
    }

    public Suppliers getSuppliers() {
        return suppliers;
    }

    public void setSuppliers(Suppliers suppliers) {
        this.suppliers = suppliers;
    }

    public Producers getProducers() {
        return producers;
    }

    public void setProducers(Producers producers) {
        this.producers = producers;
    }

    public Country getCountry() {
        return country;
    }

    public void setCountry(Country country) {
        this.country = country;
    }

    public Artist getArtist() {
        return artist;
    }

    public void setArtist(Artist artist) {
        this.artist = artist;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (mediaId != null ? mediaId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Media)) {
            return false;
        }
        Media other = (Media) object;
        if ((this.mediaId == null && other.mediaId != null) || (this.mediaId != null && !this.mediaId.equals(other.mediaId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entitybean.Media[mediaId=" + mediaId + "]";
    }

}
